from flask import Flask

from sqlalchemy.orm import Query

from airflow.patsnap.util.page_util import Pagination
from airflow.www.api.idata.auth import api_speech_auth
from airflow.www.api.idata.file import api_speech_file
from airflow.www.api.idata.datasource import api_speech_datasource
from airflow.www.api.idata.env import api_speech_env
from airflow.www.api.idata.pool import api_speech_pool
from airflow.www.api.idata.project import api_speech_project
from airflow.www.api.idata.workflow import workflow_bp
from airflow.www.api.idata.resource import api_speech_resource
from airflow.www.api.idata.role import api_speech_role
from airflow.www.api.idata.task import task_bp
from airflow.www.api.idata.user import api_speech_user
from airflow.www.api.idata.alert import alert_bp
from airflow.www.api.idata.folder import folder_bp

app = Flask(__name__)
Query.paginate = Pagination.paginate
app.register_blueprint(api_speech_user, url_prefix='/api/idata')
app.register_blueprint(api_speech_resource, url_prefix='/api/idata')
app.register_blueprint(api_speech_role, url_prefix='/api/idata')
app.register_blueprint(api_speech_auth, url_prefix='/api/idata')
app.register_blueprint(api_speech_project, url_prefix='/api/idata')
app.register_blueprint(workflow_bp, url_prefix='/api/idata')
app.register_blueprint(api_speech_file, url_prefix='/api/idata')
app.register_blueprint(task_bp, url_prefix='/api/idata')
app.register_blueprint(alert_bp, url_prefix='/api/idata')
app.register_blueprint(api_speech_datasource, url_prefix='/api/idata')
app.register_blueprint(api_speech_env, url_prefix='/api/idata')
app.register_blueprint(api_speech_pool, url_prefix='/api/idata')
app.register_blueprint(folder_bp, url_prefix='/api/idata')

app.run(debug=True)
